package com.hiro.framework.tilegame.device.factory;

import com.egghiro.framework.j2se.factory.ImplementationFactory;
import com.egghiro.framework.j2se.game.exception.SGSystemException;
import com.egghiro.framework.j2se.game.utils.PropertyUtils;
import com.hiro.framework.tilegame.constant.STileGameSystemConst;
import com.hiro.framework.tilegame.model.actor.ITileBoard;

public class TileFactory {
    
    public static ITileBoard createTileBoard() throws SGSystemException{
        String tileBoardClassName = PropertyUtils.getSystemPropertyValue(STileGameSystemConst.PROPERTY_CONCRETE_TILE_BOARD_CLASS_NAME);
//        Class<?> tilesClazz = Class.forName(tilesClassName);
//        
//        return (ITiles) Class.forName(tilesClassName).newInstance();
        
        try {
            return ImplementationFactory.create(ITileBoard.class, tileBoardClassName);
        } catch (ClassNotFoundException | InstantiationException | IllegalAccessException e) {
            throw new SGSystemException(e);
        }
        
    }

}
